package com.water.weatherservice.service;

import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author 汪胜彬
 * @version 1.0
 */
@Service
public class LocationService {

    public static final String INVOKE_URL = "http://location-provider";

    @Resource
    private RestTemplate restTemplate;

    public String getAdcode() {
        JSONObject adcodeInfo = restTemplate.getForObject(INVOKE_URL + "/location/get", JSONObject.class);
        String adcode = adcodeInfo.getString("data");
        return adcode;

    }

}
